<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
		<link rel='stylesheet' href='css/main2.css' type='text/css'>
		<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
		<meta name="viewport" content="width=device-width; initial-scale=1.0" />

		
	</head>

	<body>
		<div data-role="page"  data-theme="b">
			
			<header data-tap-toggle="false" data-position="fixed" data-role="header" role="banner">
				
				<a href="#menuPanel" data-role="button" data-icon="bars" data-iconpos="notext" data-theme="a" data-inline="true">Bars</a>
				
				<h1 id="centerheader">
					<a href="main">
						<img src="resources/img/aa.png" alt="" />
					</a>
				</h1>
				<h5>${sessionScope.userLoginInfo.name}님 환영합니다.</h5>
				<a href="#rightpanel" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="a" data-inline="true">Grid</a>
				
			</header>
							
			
			
			<section id="menuPanel" data-display="overlay" data-position-fixed="true" data-role="panel"  data-theme="b">
			<div class="ui-panel-inner" ><nav class="main-nav">
				<ul class="menupanel_one">
					<li>
					<a href="main" data-lid="home" class="ui-link active">MAIN</a>
					</li>
					
					<li>
					<a data-lid="vehicles" class="ui-link">업무보고</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="reportingregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="todayreporting" data-lid="mobile_apps" class="ui-link">일일업무</a>
							</li>
							<li>
								<a href="weekreporting" data-lid="mobile_apps" class="ui-link">주간업무</a>
							</li>
							<li>
								<a href="monthreporting" data-lid="mobile_apps" class="ui-link">월간업무</a>
							</li>
						</ul>
					<li>
						
					<a data-lid="vehicles" class="ui-link">회의록</a>
					
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="minutesregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="minuteslist" data-lid="mobile_apps" class="ui-link">지난 회의록</a>
							</li>
						</ul>
				
					<li>
						<a data-lid="mobile_apps" class="ui-link">거래처 관리</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="accountlist" data-lid="mobile_apps" class="ui-link">거래처 보기</a>
							</li>
							<li>
								<a href="accountregist" data-lid="mobile_apps" class="ui-link">거래처 등록</a>
							</li>							
						</ul>
					
					<li>
						<a href="location" data-lid="owner_site" >팀원 위치 보기</a>
					</li>
					
					<li>
						<a href="#companybbs" data-lid="owner_site" >사내 게시판</a>
					</li>
						
					<li>
						<a data-lid="owner_site" >PT</a>
					</li>
						<ul class="menupanel_two">
							<li>
								<a href="ptregist" data-lid="mobile_apps" class="ui-link">등 록</a>
							</li>
							<li>
								<a href="ptview" data-lid="mobile_apps" class="ui-link">보 기</a>
							</li>							
						</ul>
					
				</ul>
				</nav></div>
			</section>	
			
			
					
			<div data-role="panel" id="rightpanel" data-display="overlay" data-position="right" data-theme="b">
				
			</div>
			
					
			<ul id="minuteslist" data-role="listview" data-inset="true" data-theme="d" data-divider-theme="e" data-count-theme="b" >
					           
			</ul>
			
			<a id="addlist" data-role="button" data-theme="c" data-icon="arrow-d" data-iconpos="bottom" data-icon="gear" data-iconshadow="false" data-theme="b"></a>	
	
			<form method="get" data-ajax="ture">
				<input type="hidden" id="departCode" name="departCode" value=${sessionScope.userLoginInfo.departCode}>
				<input type="hidden" id="page" name="page" value="1">
			</form>		
			
			
			
			<script>
			$(document).on("swipeleft", function(event, ui){
				$("#rightpanel").panel("open");
			});
			
			$(document).on("swiperight", function(event, ui){
				$("#menuPanel").panel("open");
			});
			
			
			function addList(){
				
				console.log("addList.......... page : ");
				
				$.post('minuteslist', {"departCode" : $('#departCode').val(), "page" : $('#page').val()} ).done(function(data){
			
				
					if (data.length > 0) {
						
						console.log("success!!");
						
						$('#page').val(Number($('#page').val())+1);
						
						console.log($('#page').val());
						
						listload(data);
				
					} else { 
					
						console.log("fail!");
						
					
						return;
					
					}
				
				});
				
			}
			
			function listload(data){
		    	
				console.log(data);
				
				var list = "";
				
				for(var i = 0 ; i < data.length-1 ; i++){
					list += "<li><a href='minutesview?seqno=" + data[i].seqno + "' data-theme='e'>";
					list += "<h2>"+ data[i].title + "( 일시 : " + data[i].openDay + ")</h2>";
					list += "<p>" + data[i].regdate + "</p></a>";
					list += "<span class='ui-li-count' data-theme='e'>" + data[i].replyCnt + "</span></a></li>";
	
				}
				
				$('#minuteslist').append(list);
				$('#minuteslist').listview( "refresh" );
			}
			
			$('#addlist').click(function(){
				addList();
			});
			
			addList();
			
			
			</script>
			
		</div>	
	</body>
</html>